
import os

Import('env', 'targetroot', 'project', 'buildmode', 'debugflags', 'releaseflags')

localenv = env.Clone()

buildroot=os.path.join('#builds', buildmode, project)
targetpath=os.path.join(targetroot, project)

localenv.Append(CPPPATH = ['include'])
if buildmode == 'debug':
    localenv.Append(CCFLAGS=debugflags)
else:
    localenv.Append(CCFLAGS=releaseflags)

#filelist = map(lambda x: os.path.join(buildroot, os.path.basename(str(x))), Glob('src/*/*.cpp') + Glob('src/sys/*/*.cpp'))
filelist = map(lambda x: str(x).replace('src', buildroot), Glob('src/*/*.cpp') + Glob('src/sys/*/*.cpp'))

localenv.VariantDir(buildroot, 'src', duplicate=0)

target = localenv.SharedLibrary(
    targetpath,
    filelist)

env.Alias('all', target)

